home *** CD-ROM | disk | FTP | other *** search
-
-
- The Heart of the CLI Interpreter
-
- COBEGIN
- - Input: the forms to be evaluated concurrently (the tasks)
- Output: a list of the values to these forms
- - initialize pseudo clock used to switch between tasks
- - create a stack group for each concurrent task
- - initiate concurrent execution
- - create a list of the values of the tasks
-
- CLI_EVAL
- - Input: a form to be evaluated
- Output: the value of the form
- - increment pseudo clock
- - if switching is enabled
- and we have reached the end of a time slice
- and we are in concurrent mode,
- then
- - suspend current task and enable switching
- else
- - evaluate the form
- - return the value
-
- SWITCH-AROUND
- - Input: none
- Output: none
- - if all tasks are complete,
- then
- - return
- else
- - randomly choose a task to execute
- - if this task has completed,
- then
- - eliminate it from the list of tasks
- - try again
- else
- - initiate task execution